package cn.helios.service.impl;

import cn.helios.config.ProductFeignClient;
import cn.helios.domain.Product;


import cn.helios.domian.Store;
import cn.helios.mapper.ProductMapper;
import cn.helios.service.IProductService;
import cn.helios.ulit.Ajaxresult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProductServiceImpl implements IProductService {

    @Autowired
    private ProductMapper productMapper;

    @Autowired
    private ProductFeignClient productFeignClient;

    @Override
    public Ajaxresult add(Product product) {

        productMapper.add(product);

        Store store = new Store();

        store.setProductId(product.getId());

        store.setNumber(product.getNumber());

        Ajaxresult add = productFeignClient.add(store);

        return add;
    }
}
